# -*- mode: python; coding: utf-8; -*-
##--------------------------------------------------------------------------##
##
## Copyright (C) 1998-2003 Markus Oberhumer <markus@oberhumer.com>
## Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2010 Skomoroh <skomoroh@users.sourceforge.net>
## Copyright (C) 2010-2013 Jeremy Austin-Bardo <tjaustinbardo@gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <http://www.gnu.org/licenses/>.
##
##--------------------------------------------------------------------------##
__docformat__ = 'restructuredtext en'
__all__ = []

from ... import pilelib as stack
from ...gamelib.info import GT, SL
from ...packlib import info as cs
from .. import klondike

Wrap = stack.StackWrapper


class Kurma(cs.Dashavatara_Deck, klondike.Klondike):
    """
    Finish 1 deck on _foundation_.

    :CVariables:
      _layout_ : pysollib.layout.Layout
        .. pysollib.layouts.klondike.KlondikeLayout

        - row [10 horz S foundation, vert offset]
        - talon [1 NW, no offset]
        - waste [1 E talon, no offset]
        - foundation [5 over 2 row N, no offset]

      _talon_ : pysollib.stack.Stack
        .. pysollib.stack.WasteTalon (max_rounds=INFINITE)

        Deal 1 card per waste on click. Unlimited redeals.

      _waste_ : pysollib.stack.Stack
        .. pysollib.stack.WasteStack

        Init 1 card. Build none. Play top.

      _foundation_ : pysollib.stack.Stack
        .. pysollib.stack.SS_Foundation (max_move=0)

        Build up in rank by same suit. Play none. Base ace.

      _row_ : pysollib.stack.Stack
        .. pysollib.stack.SS_RowStack (base_rank=RAJA)

        Init 1..10 card. Build down in rank by same suit. Play sequence.
        Base raja.

      _hint_ : pysollib.hint.AbstractHint
        .. pysollib.hint.DefaultHint
    """
    __info__ = dict(id=15407, name='Kurma',
                    category=cs.TYPE_DASHAVATARA_GANJIFA,
                    game_type=GT.KLONDIKE, decks=1, redeals=cs.INFINITE,
                    skill_level=SL.BALANCED, version='0.50fc')
    __author__ = 'Mt. Hood Playing Card'
    __version__ = 7.70

    _foundation_ = Wrap(stack.SS_Foundation, max_move=0)
    _row_ = Wrap(stack.SS_RowStack, base_rank=cs.RAJA)

    def _create_game(self, **kw):
        """
        Create game format.

        Augment pile placements based on current form and group attributes.

        .. \_create_game(rows=10) -> Layout
        """
        kw.setdefault('rows', 10)
        return super(Kurma, self)._create_game(**kw)


class Matsya(Kurma):
    """
    Finish 1 deck on _foundation_.

    :CVariables:
      _layout_ : pysollib.layout.Layout
        .. pysollib.layouts.klondike.KlondikeLayout

        - row [10 horz S foundation, vert offset]
        - talon [1 NW, no offset]
        - waste [1 E talon, no offset]
        - foundation [5 over 2 row N, no offset]

      _talon_ : pysollib.stack.Stack
        .. pysollib.stack.WasteTalon

        Deal 1 card per waste on click. No redeals.

      _waste_ : pysollib.stack.Stack
        .. pysollib.stack.WasteStack

        Init 1 card. Build none. Play top.

      _foundation_ : pysollib.stack.Stack
        .. pysollib.stack.SS_Foundation (max_move=0)

        Build up in rank by same suit. Play none. Base ace.

      _row_ : pysollib.stack.Stack
        .. pysollib.stack.RK_RowStack (base_rank=RAJA)

        Init 1..10 card. Build down in rank alone. Play sequence. Base raja.

      _hint_ : pysollib.hint.AbstractHint
        .. pysollib.hint.DefaultHint
    """
    __info__ = dict(id=15406, name='Matsya',
                    category=cs.TYPE_DASHAVATARA_GANJIFA,
                    game_type=GT.KLONDIKE, decks=1,
                    skill_level=SL.BALANCED, version='0.50fc')
    __author__ = 'Mt. Hood Playing Card'
    __version__ = 7.70

    _talon_ = stack.WasteTalon
    _row_ = Wrap(stack.RK_RowStack, base_rank=cs.RAJA)


class Varaha(Kurma):
    """
    Finish 1 deck on _foundation_.

    :CVariables:
      _layout_ : pysollib.layout.Layout
        .. pysollib.layouts.klondike.KlondikeLayout

        - row [10 horz S foundation, vert offset]
        - talon [1 NW, no offset]
        - waste [1 E talon, no offset]
        - foundation [5 over 2 row N, no offset]

      _talon_ : pysollib.stack.Stack
        .. pysollib.stack.WasteTalon (max_rounds=INFINITE, num_deal=3)

        Deal 3 card per waste on click. Unlimited redeals.

      _waste_ : pysollib.stack.Stack
        .. pysollib.stack.WasteStack

        Init 3 card. Build none. Play top.

      _foundation_ : pysollib.stack.Stack
        .. pysollib.stack.SS_Foundation (max_move=0)

        Build up in rank by same suit. Play none. Base ace.

      _row_ : pysollib.stack.Stack
        .. pysollib.stack.SS_RowStack (base_rank=RAJA)

        Init 1..10 card. Build down in rank by same suit. Play sequence.
        Base raja.

      _hint_ : pysollib.hint.AbstractHint
        .. pysollib.hint.DefaultHint
    """
    __info__ = dict(id=15408, name='Varaha',
                    category=cs.TYPE_DASHAVATARA_GANJIFA,
                    game_type=GT.KLONDIKE, decks=1, redeals=cs.INFINITE,
                    skill_level=SL.BALANCED, version='0.50fc')
    __author__ = 'Mt. Hood Playing Card'
    __version__ = 7.70

    _talon_ = Wrap(stack.WasteTalon, max_rounds=cs.INFINITE, num_deal=3)


class Narasimha(Matsya):
    """
    Finish 1 deck on _foundation_.

    :CVariables:
      _layout_ : pysollib.layout.Layout
        .. pysollib.layouts.klondike.KlondikeLayout

        - row [10 horz S foundation, vert offset]
        - talon [1 NW, no offset]
        - waste [1 E talon, no offset]
        - foundation [5 over 2 row N, no offset]

      _talon_ : pysollib.stack.Stack
        .. pysollib.stack.WasteTalon

        Deal 1 card per waste on click. No redeals.

      _waste_ : pysollib.stack.Stack
        .. pysollib.stack.WasteStack

        Init 1 card. Build none. Play top.

      _foundation_ : pysollib.stack.Stack
        .. pysollib.stack.SS_Foundation (max_move=0)

        Build up in rank by same suit. Play none. Base ace.

      _row_ : pysollib.stack.Stack
        .. pysollib.stack.AC_RowStack (base_rank=RAJA)

        Init 1..10 card. Build down in rank by alt color. Play sequence.
        Base raja.

      _hint_ : pysollib.hint.AbstractHint
        .. pysollib.hint.DefaultHint
    """
    __info__ = dict(id=15409, name='Narasimha',
                    category=cs.TYPE_DASHAVATARA_GANJIFA,
                    game_type=GT.KLONDIKE, decks=1,
                    skill_level=SL.BALANCED, version='0.50fc')
    __author__ = 'Mt. Hood Playing Card'
    __version__ = 7.70

    _row_ = Wrap(stack.AC_RowStack, base_rank=cs.RAJA)


class Vamana(Varaha):
    """
    Finish 1 deck on _foundation_.

    :CVariables:
      _layout_ : pysollib.layout.Layout
        .. pysollib.layouts.klondike.KlondikeLayout

        - row [10 horz S foundation, vert offset]
        - talon [1 NW, no offset]
        - waste [1 E talon, no offset]
        - foundation [5 over 2 row N, no offset]

      _talon_ : pysollib.stack.Stack
        .. pysollib.stack.WasteTalon (max_rounds=INFINITE)

        Deal 1 card per waste on click. Unlimited redeals.

      _waste_ : pysollib.stack.Stack
        .. pysollib.stack.WasteStack

        Init 1 card. Build none. Play top.

      _foundation_ : pysollib.stack.Stack
        .. pysollib.stack.SS_Foundation (max_move=0)

        Build up in rank by same suit. Play none. Base ace.

      _row_ : pysollib.stack.Stack
        .. pysollib.stack.AC_RowStack (base_rank=RAJA)

        Init 1..10 card. Build down in rank by alt color. Play sequence.
        Base raja.

      _hint_ : pysollib.hint.AbstractHint
        .. pysollib.hint.DefaultHint
    """
    __info__ = dict(id=15410, name='Vamana',
                    category=cs.TYPE_DASHAVATARA_GANJIFA,
                    game_type=GT.KLONDIKE, decks=1, redeals=cs.INFINITE,
                    skill_level=SL.BALANCED, version='0.50fc')
    __author__ = 'Mt. Hood Playing Card'
    __version__ = 7.70

    _row_ = Wrap(stack.AC_RowStack, base_rank=cs.RAJA)


class Parashurama(Matsya):
    """
    Finish 1 deck on _foundation_.

    :CVariables:
      _layout_ : pysollib.layout.Layout
        .. pysollib.layouts.klondike.KlondikeLayout

        - row [10 horz S foundation, vert offset]
        - talon [1 NW, no offset]
        - waste [1 E talon, no offset]
        - foundation [5 over 2 row N, no offset]

      _talon_ : pysollib.stack.Stack
        .. pysollib.stack.WasteTalon (max_rounds=2, num_deal=3)

        Deal 3 card per waste on click. 2 redeals.

      _waste_ : pysollib.stack.Stack
        .. pysollib.stack.WasteStack

        Init 3 card. Build none. Play top.

      _foundation_ : pysollib.stack.Stack
        .. pysollib.stack.SS_Foundation (max_move=0)

        Build up in rank by same suit. Play none. Base ace.

      _row_ : pysollib.stack.Stack
        .. pysollib.stack.RK_RowStack (base_rank=RAJA)

        Init 1..10 card. Build down in rank by alt color. Play sequence.
        Base raja.

      _hint_ : pysollib.hint.AbstractHint
        .. pysollib.hint.DefaultHint
    """
    __info__ = dict(id=15411, name='Parashurama',
                    category=cs.TYPE_DASHAVATARA_GANJIFA,
                    game_type=GT.KLONDIKE, decks=1, redeals=1,
                    skill_level=SL.BALANCED, version='0.50fc')
    __author__ = 'Mt. Hood Playing Card'
    __version__ = 7.70

    _talon_ = Wrap(stack.WasteTalon, max_rounds=2, num_deal=3)
    _row_ = Wrap(stack.RK_RowStack, base_rank=cs.RAJA)


PROVIDES = [Kurma, Matsya, Narasimha, Parashurama, Vamana, Varaha]